/****************************************************
	文件：HTLoggerInstaller.cs
	作者：HuskyT
	邮箱：1005240602@qq.com
	日期：2020/9/4 17:10:26
	功能：HTLogger 安装器
*****************************************************/

using UnityEngine;

namespace HTUtility
{
    public class HTLoggerInstaller : Singleton<HTLoggerInstaller>
    {
        public class UnityDebugListener : ILoggerListener
        {
            public void Log(string msg)
            {
                Debug.Log(msg);
            }
        }
        public class UnityWarningListener : ILoggerListener
        {
            public void Log(string msg)
            {
                Debug.LogWarning(msg);
            }
        }
        public class UnityErrorListener : ILoggerListener
        {
            public void Log(string msg)
            {
                Debug.LogError(msg);
            }
        }

        public void Install()
        {
            UnityDebugListener unityDebugListener = new UnityDebugListener();
            UnityWarningListener unityWarningListener = new UnityWarningListener();
            UnityErrorListener unityErrorListener = new UnityErrorListener();
            HTLogger.Instance.Init(true);
            HTLogger.Instance.AddListener(HTLogger.Channel.Info, unityDebugListener);
            HTLogger.Instance.AddListener(HTLogger.Channel.Todo, unityDebugListener);
            HTLogger.Instance.AddListener(HTLogger.Channel.Debug, unityDebugListener);
            HTLogger.Instance.AddListener(HTLogger.Channel.Warning, unityWarningListener);
            HTLogger.Instance.AddListener(HTLogger.Channel.Error, unityErrorListener);

            HTLogger.Info("HTLogger init done.");
        }
    }
}
